//滚动字幕
$(document).ready(function(e) {
    var start_div = $('#scrollText');
    var tmp_str = '';
    tmp_str = start_div.html();
//ScrollTime
ScrollText(start_div,23,start_div.width(),tmp_str,'left',1,20);
});

function ScrollText(AppendToObj,ShowHeight,ShowWidth,ShowText,ScrollDirection,Steper,Interval){
    var TextWidth,PosInit,PosSteper;
    with(AppendToObj){
        html('');
        css('overflow','hidden');
        css('height',ShowHeight+'px');
        css('line-height',ShowHeight+'px');
        css('width',ShowWidth);
    }
    if (ScrollDirection=='left'){
        PosInit = ShowWidth;
        PosSteper = Steper;
    }
    else{
        PosSteper = 0 - Steper;
    }
if(Steper<1 || Steper>ShowWidth){Steper = 1}//每次移动间距超出限制(单位:px)
if(Interval<1){Interval = 10}//每次移动的时间间隔（单位：毫秒）
    var Container = $('<div></div>');
var ContainerID = 'ContainerTemp';
var i = 0;
while($('#'+ContainerID).length>0){
    ContainerID = ContainerID + '_' + i;
    i++;
}
with(Container){
    attr('id',ContainerID);
    css('float','left');
    css('cursor','default');
    appendTo(AppendToObj);
    html(ShowText);
    TextWidth = width();
    css('width',ShowWidth * 2);
    if(isNaN(PosInit)){PosInit = 0 - TextWidth;}
    css('margin-left',PosInit);
    mouseover(function(){
        clearInterval(ScrollTime);
    });
    mouseout(function(){
        ScrollTime = setInterval("ScrollAutoPlay('"+ContainerID+"','"+ScrollDirection+"',"+ShowWidth+','+TextWidth+","+PosSteper+")",Interval);
    });
}

ScrollTime = setInterval("ScrollAutoPlay('"+ContainerID+"','"+ScrollDirection+"',"+ShowWidth+','+TextWidth+","+PosSteper+")",Interval);
}
var ScrollTime;
function ScrollAutoPlay(contID,scrolldir,showwidth,textwidth,steper){
    var PosInit,currPos;
    with($('#'+contID)){
        currPos = parseInt(css('margin-left'));
        if(scrolldir=='left'){
            if(currPos<0 && Math.abs(currPos)>textwidth){
                css('margin-left',showwidth);
            }
            else{
                css('margin-left',currPos-steper);
            }
        }
        else{
            if(currPos>showwidth){
                css('margin-left',(0-textwidth));
            }
            else{
                css('margin-left',currPos-steper);
            }
        }
    }
}